using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CreateObject : MonoBehaviour
{

    protected Animator animator;
    protected Character character;
    // Start is called before the first frame update
    public void Start()
    {
        animator = GetComponent<Animator>();
        character = GetComponentInParent<Character>();

    }

    public virtual GameObject CreateEffects(GameObject gameObj, Vector2 deviation)
    {
        Vector3 createPos = new Vector3(transform.position.x + deviation.x * character.GetScaleX(), transform.position.y + deviation.y, transform.position.z);
        GameObject createObj =  Instantiate(gameObj, createPos, transform.rotation);
        createObj.transform.SetParent(transform.parent);
        return createObj;
    }

    public virtual GameObject CreateFlyingAttack(GameObject gameObj, Vector2 deviation)
    {
        Vector3 createPos = new Vector3(transform.position.x + deviation.x * character.GetScaleX(), transform.position.y + deviation.y, transform.position.z);
        GameObject createObj = Instantiate(gameObj, createPos, transform.rotation);
        FlyingAttack objFlying = createObj.GetComponent<FlyingAttack>();
        objFlying.Init(transform.parent.position.y, character.GetScaleX());
        return createObj;
    }


}
